package net.sareweb.acab.entity;

// Generated 13-abr-2010 15:53:20 by Hibernate Tools 3.2.5.Beta

import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import org.hibernate.validator.Length;
import org.hibernate.validator.NotNull;

/**
 * Seat generated by hbm2java
 */
@Entity
@Table(name = "seat", catalog = "acab")
public class Seat implements java.io.Serializable {

	private Integer idSeat;
	private Travel travel;
	private User user;
	private int seatNumber;
	private String state;
	private Set<Evaluation> evaluations = new HashSet<Evaluation>(0);

	public Seat() {
	}

	public Seat(Travel travel, int seatNumber, String state) {
		this.travel = travel;
		this.seatNumber = seatNumber;
		this.state = state;
	}

	public Seat(Travel travel, User user, int seatNumber, String state,
			Set<Evaluation> evaluations) {
		this.travel = travel;
		this.user = user;
		this.seatNumber = seatNumber;
		this.state = state;
		this.evaluations = evaluations;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "idSeat", unique = true, nullable = false)
	public Integer getIdSeat() {
		return this.idSeat;
	}

	public void setIdSeat(Integer idSeat) {
		this.idSeat = idSeat;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "travel", nullable = false)
	@NotNull
	public Travel getTravel() {
		return this.travel;
	}

	public void setTravel(Travel travel) {
		this.travel = travel;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "assignedUser")
	public User getUser() {
		return this.user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	@Column(name = "seatNumber", nullable = false)
	public int getSeatNumber() {
		return this.seatNumber;
	}

	public void setSeatNumber(int seatNumber) {
		this.seatNumber = seatNumber;
	}

	@Column(name = "state", nullable = false, length = 10)
	@NotNull
	@Length(max = 10)
	public String getState() {
		return this.state;
	}

	public void setState(String state) {
		this.state = state;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "seat")
	public Set<Evaluation> getEvaluations() {
		return this.evaluations;
	}

	public void setEvaluations(Set<Evaluation> evaluations) {
		this.evaluations = evaluations;
	}

}
